<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>TZ-追梦</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        li{
            list-style: none;
        }
        body{
            background: black;
        }
        #box{
            width: 1000px;
            height: 300px;
            border: 8px solid white;
            margin: 80px auto;
            box-shadow: 0 0  100px white;
        }
        #box ul{
            height: 100%;
            display: flex;
        }
        #box ul li{
            flex: 1;
            box-sizing: border-box;
            border-right: 1px solid white;
            position: relative;
            overflow: hidden;
            background: white;
            transition: 0.5s;
        }
        #box ul li:last-child{
            border: 0;
        }
        #box ul li .content{
            position: absolute;
            left:0;
            right:0;
            top:0;
            bottom: 0;
            margin: auto;
            width: 650px;
            height: 200px;
        }
        #box ul li p{
            position: absolute;
            width: 100%;
            height: 100%;
            color: white;
            background: rgba(0,0,0,0.6);
            text-align: center;
            font:18px/300px 'Microsoft yahei';
            font-weight: bold;
            transition: 0.5s;
        }
        #box ul li p.top{
            top:0;
        }
        #box ul li p.bottom{
            bottom:0;
        }
        #box ul li:hover{
            flex: 3;
        }
        #box ul li:hover p{
            height: 50px;
            line-height: 50px;
        }
    </style>
</head>
<body>
    <div id="box">
        <ul>
            <li>
                <div class="content"></div>
                <p class="top">风手琴</p>
                <p class="bottom">风手琴</p>
            </li>
            <li>
                <div class="content"></div>
                <p class="top">风手琴</p>
                <p class="bottom">风手琴</p>
            </li>
            <li>
                <div class="content"></div>
                <p class="top">风手琴</p>
                <p class="bottom">风手琴</p>
            </li>
            <li>
                <div class="content"></div>
                <p class="top">风手琴</p>
                <p class="bottom">风手琴</p>
            </li>
            <li>
                <div class="content"></div>
                <p class="top">风手琴</p>
                <p class="bottom">风手琴</p>
            </li>
        </ul>
    </div>

    <script>
        var aCon = document.querySelectorAll('.content');
        for(var i=0;i<aCon.length;i++){
            aCon[i].style.background = color();
        }

        function  color() {
            var r = Math.floor(Math.random()*256);
            var g = Math.floor(Math.random()*256);
            var b = Math.floor(Math.random()*256);

            return 'rgb('+r+','+g+','+b+')';
        }
    </script>
</body>
</html>